package com.azier.kapacitor.script.node;

import com.azier.kapacitor.script.method.Level;
import com.azier.kapacitor.script.method.Prefix;
import com.azier.kapacitor.script.method.Quiet;
import com.azier.kapacitor.script.node.nodebind.StatsNodeBind;

import java.util.ArrayList;

/**
* 1 * @Author: luoj
* 2 * @Date: 2019/11/8 11:27
* 3
*/

/**
Create a node that logs all data it receives.
**/
/**
创建一个节点，记录接收到的所有数据。
**/
public class LogNode extends AbstractNode implements StatsNodeBind {
    private static final String name = "log";

    public LogNode() {
        super(new ArrayList<>(),new ArrayList<>(),name);
    }

    /**
    The level at which to log the data. One of: DEBUG, INFO, WARN, ERROR Default: INFO
    **/
    /**
    记录数据的级别。下列之一：DEBUG，INFO，WARN，ERROR默认：INFO
    **/
    public LogNode level(String log){
        Level level = new Level(log);
        super.addMethod(level);
        return this;
    }
    /**
    Optional prefix to add to all log messages
    **/
    /**
    添加到所有日志消息的可选前缀
    **/
    public LogNode prefix(String log){
        Prefix prefix = new Prefix(log);
        super.addMethod(prefix);
        return this;
    }
    /**
    Suppress all error logging events from this node.
    **/
    /**
    禁止来自此节点的所有错误记录事件。
    **/
    public LogNode quiet(){
        Quiet quiet = new Quiet();
        super.addMethod(quiet);
        return this;
    }
}